/**
 * date:2022/5/23
 * anthor:王娟
 * info:新增删除行,游戏结束,动画方法
 * change:
 */
function drawMap(ctx,point,size,left,top){
    for(let i=0;i<point.length;i++){
            ctx.fillRect(point[i].x*size/2+left,point[i].y*size/2+top,size/2-1,size/2-1);
            ctx.rect(point[i].x*size/2+left,point[i].y*size/2+top,size/2-1,size/2-1)
        }
        ctx.stroke();
}
function can(){
    canvas.Map();
   canvas.Block();
}
function xun(ctx,size){
    for(let i=0;i<20;i++){
            for(let j=0;j<10;j++){
                if(mapArray[i][j]){
                    ctx.fillRect(j*size,i*size,size,size)
                }
               ctx.rect(j*size,i*size,size,size)
            }
        }
        ctx.stroke();
}
//消行
let  cl= function(){
    for(let i=0;i<mapArray.length;i++){
        let clear1=true
        for(let j=0;j<mapArray[i].length;j++){
            if(mapArray[i][j]==false){
                clear1=false;
                break;
            }
        }
        if(clear1){
            mapArray.splice(i,1);
            let temp=[false,false,false,false,false,false,false,false,false,false]
            mapArray.unshift(temp);
            i--;
            count+=10;
            canvas.Score()
        }
    }
}
//游戏结束
function over(){
    let point=block.point;
      for(let i=0;i<point.length;i++){
          if(mapArray[point[i].y][point[i].x]){
              return true
          }
      }
      return false
  }
function start(){
    clearInterval(time);
    location.reload();
}
function stop(){
    clearInterval(time)
}
function play(){
    time= setInterval(() => {
        block.move()
        canvas.Map();
    canvas.Block();
    }, 600);
}